package edu.nf.exam.service.impl;

import edu.nf.exam.dao.ErrorQuestionInfoDao;
import edu.nf.exam.dao.impl.ErrorQuestionInfoDaoImpl;
import edu.nf.exam.entity.ErrorQuestionInfo;
import edu.nf.exam.exception.DataAcessException;
import edu.nf.exam.service.ErrorQuestionService;

import java.util.List;

/**
 * @Author : QYM
 * @create 2021/6/17
 * 错题信息表--业务接口实现类
 */
public class ErrorQuestionServiceImpl implements ErrorQuestionService {
    /**
     * 添加
     * @param errorQuestionInfo
     */
    @Override
    public int add(ErrorQuestionInfo errorQuestionInfo) {
        ErrorQuestionInfoDao dao=new ErrorQuestionInfoDaoImpl();
        try {
            int r = dao.add(errorQuestionInfo);
            return r;
        } catch (Exception e) {
            e.printStackTrace();
            throw new DataAcessException("添加失败");
        }
    }

    /**
     * 查询
     * @param errorQuestionInfo
     * @return
     */
    @Override
    public List<ErrorQuestionInfo> select(ErrorQuestionInfo errorQuestionInfo) {
        ErrorQuestionInfoDao dao=new ErrorQuestionInfoDaoImpl();
        try {
            List<ErrorQuestionInfo> list = dao.select(errorQuestionInfo);
            return list;
        } catch (Exception e) {
            e.printStackTrace();
            throw new DataAcessException("查询失败");
        }
    }
}
